/*   Copyright 2012 Julian Aloofi

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#ifndef TACTICUS_SCREENMANAGER_HPP
#define TACTICUS_SCREENMANAGER_HPP

#include <list>
#include <boost/shared_ptr.hpp>

#include "Application/Events/IEventListener.hpp"
#include "Application/Events/ProcessInputEvent.hpp"
#include "Application/Events/DrawScreenEvent.hpp"
#include "Application/Events/NewGameEvent.hpp"
#include "Application/Events/GameOverEvent.hpp"
#include "Application/Events/ShowDrawTurnScreenEvent.hpp"
#include "Interface/WindowManager.hpp"
#include "Interface/Screens/Screen.hpp"
#include "Interface/Screens/MainMenuScreen.hpp"
#include "Interface/Screens/GameScreen.hpp"
#include "Interface/Screens/ConfirmOKDialogScreen.hpp"
#include "Interface/Screens/DrawTurnScreen.hpp"
#include "Exceptions.hpp"

namespace Tacticus
{

class ScreenManager : public IEventListener
{
private:
    static ScreenManager *instance;
    std::list<boost::shared_ptr<Screen> > currentScreens;
public:
    static ScreenManager &getInstance();
    static void destroy();
    const Screen &getCurrentScreen() const;
private:
    ScreenManager() {}
    ScreenManager(const ScreenManager&) {}
    ~ScreenManager() {}
    void processCurrentInput();
    void drawCurrentScreen();
public:
    void handleEvent(boost::shared_ptr<Event> event);
};

}

#endif
